package com.glorysoft.hlgdpda.base

import android.util.Log
import com.glorysoft.hlgdpda.entity.net.BaseRequestBean
import com.glorysoft.hlgdpda.entity.net.HeaderBean
import com.glorysoft.hlgdpda.entity.net.NetRequestBean
import com.google.gson.Gson
import com.google.gson.JsonObject
import org.apache.commons.lang3.StringEscapeUtils
import java.util.*

/**
 * @author HX
 * @date 2021/4/21
 * @desc
 */
open class BaseRepository {
    protected fun getInJsonData(map: JsonObject,messageName : String): Map<String,String> {
        val format: NetRequestBean<*> = NetRequestBean<Any?>()
        format.body =map
        format.header = HeaderBean(messageName)
        val message: BaseRequestBean<*> = BaseRequestBean<Any?>()
        message.request = format
        val map: MutableMap<String, String> = HashMap()
        map["senderId"] = "EAP2CPCSender"
        map["requestMessage"] = StringEscapeUtils.unescapeJson(Gson().toJson(message))
        map["timeOut"] = "5000"
        Log.e("请求JSON", "getInJsonData: " + StringEscapeUtils.unescapeJson(Gson().toJson(message)))
        return map
    }
}